<!--
 * @Description: ajax
 * @Author: rendc
 * @Date: 2022-09-06 15:04:12
 * @LastEditors: rendc
 * @LastEditTime: 2022-09-06 15:16:35
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ajax</title>
</head>

<body>

</body>
<script>
  if (window.XMLHttpRequest) {
    // 1. 发送http请求
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'http://baidu.com', true);
    xhr.send();
    // 2. 处理服务器的响应

  } else {
    alert("请换一个浏览器使用该网站")
  }
</script>

</html>